<script setup lang="ts">
import GlobalHeader from './global-header/index.vue';
import { useBreakpoint } from '../hooks/useBreakpoint';

// 获取当前屏幕断点
const { breakpoint, isMobile, isTablet, isDesktop } = useBreakpoint();
</script>

<template>
  <div id="basic-layout" :class="[
    `breakpoint-${breakpoint}`,
    { 'mobile': isMobile(), 'tablet': isTablet(), 'desktop': isDesktop() }
  ]">
    <a-layout>
      <a-layout-header class="header">
        <GlobalHeader />
      </a-layout-header>
      <a-layout-content class="content">
        <div class="content-wrapper">
          <router-view></router-view>
        </div>
      </a-layout-content>
      <!-- <a-layout-footer class="footer">© 2024 Sakura OJ. All rights reserved.</a-layout-footer> -->
    </a-layout>
  </div>
</template>

<style scoped>
#basic-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #f5f7fa 0%, #f8e7ed 100%);
}

#basic-layout .header {
  height: 60px;
  line-height: 60px;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-bg-2);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#basic-layout .content {
  flex: 1;
  background: linear-gradient(135deg, #f5f7fa 0%, #f8e7ed 100%);
  padding: 16px;
}

#basic-layout .content-wrapper {
  max-width: 1200px;
  margin: 24px auto;
  width: 100%;
}

#basic-layout .footer {
  text-align: center;
  line-height: 40px;
  /* background-color: #efefef; */
  height: 40px;
}

/* 响应式布局 */
/* 手机设备 - xs */
@media (max-width: 576px) {
  #basic-layout .content {
    padding: 8px;
  }
  
  #basic-layout .header {
    height: 60px;
    line-height: normal;
  }
  
  #basic-layout .footer {
    font-size: 12px;
  }
}

/* 平板设备 - sm */
@media (min-width: 576px) and (max-width: 768px) {
  #basic-layout .content {
    padding: 12px;
  }
  
  #basic-layout .content-wrapper {
    max-width: 100%;
  }
}

/* 中等屏幕 - md, lg */
@media (min-width: 768px) and (max-width: 1200px) {
  #basic-layout .content-wrapper {
    max-width: 960px;
  }
}

/* 针对不同设备的特定样式 */
#basic-layout.mobile .content {
  background: linear-gradient(to bottom, #bbb, #fff);
}

#basic-layout.tablet .content {
  background: linear-gradient(135deg, #bbb, #fff);
}

@keyframes sakura-fall {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 100% 100%;
  }
}
</style>
